# 图像旋转

import cv2
import numpy as np

# 读取图像
image = cv2.imread('./static/3.png')

# 获取图像尺寸
height, width = image.shape[:2]

# 定义旋转角度
angle = 45

# 计算旋转矩阵
rotation_matrix = cv2.getRotationMatrix2D((width/2, height/2), angle, 1)

# 进行图像旋转
rotated_image = cv2.warpAffine(image, rotation_matrix, (width, height))

# 显示原始图像和旋转后的图像
cv2.imshow('Original Image', image)
cv2.imshow('Rotated Image', rotated_image)
cv2.waitKey(0)
cv2.destroyAllWindows()
